<?php
	include_once '../../conn/mysql.php';
	if(isset($_GET['id'])){
		$id=$_GET["id"];
		$res=sql("s", "product", "*", "where id=".$id);
		$info=firstrow($res);
		$u_id="&id=".$id;
		$suk=explode("-|-", gv($info,"suk"));
		$jg=explode("-|-", gv($info,"jg"));
		$fc=explode("-|-", gv($info,"fc"));
		$cb=explode("-|-", gv($info,"cb"));
	}else{
		$info='';
		$u_id='';
		$num4=1;
	}
	function shuzu($arr,$i){
		if (isset($arr[$i])) {
			return $arr[$i];
		}else{
			return '';
		}
	}
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../templates/met/images/css/reset.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../templates/met/images/css/metinfo.css" />
<script type="text/javascript"src="../include/metvar.js"></script>
<script type="text/javascript" src="../include/metinfo.js"></script>
<script type="text/javascript" src="../../public/js/metinfo-min.js"></script>
<script type="text/javascript" src="../templates/met/images/js/iframes.js"></script>
<script type="text/javascript" src="../templates/met/images/js/cookie.js"></script>
<style type="text/css">
body{
	font-size: ; 
	font-family:;
	text-align:center;
}
</style>
<script type="text/javascript">
//ajax执行时间
var time=200;
var lang = 'cn';
var metimgurl='../templates/met/images/';
</script>
<script type="text/javascript">
	$(document).keypress(function(e){  
	var type = e.keyCode||e.which||e.charCode;
		if(type==27){ 		
			parent.sitemp('set/sitemap.php?lang=cn&admintp=&langset=cn');  
		}				
	});
</script>

<link rel="stylesheet" href="../../editor/themes/default/default.css" />
	<link rel="stylesheet" href="../../editor/plugins/code/prettify.css" />
	<script charset="utf-8" src="../../editor/kindeditor.js"></script>
	<script charset="utf-8" src="../../editor/lang/zh_CN.js"></script>
	<script charset="utf-8" src="../../editor/plugins/code/prettify.js"></script>
<script>

		KindEditor.ready(function(K) {
			var editor1 = K.create('textarea[name="content"]', {
				cssPath : '../../editor/plugins/code/prettify.css',
				uploadJson : '../../editor/php/upload_json.php',
				fileManagerJson : '.../../editor/php/file_manager_json.php',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						K('form[name=myform]')[0].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						K('form[name=myform]')[0].submit();
					});
				}
			});
			prettyPrint();
		});
	</script>
<title>添加内容</title>
<script language = 'JavaScript'>
var onecount;
subcat = new Array();
onecount=0;
function Checkimg(){ 
if (document.myform.title.value==null || document.myform.title.value.length == 0) {
	alert(user_msg['js13']);
	document.myform.title.focus();
	return false;
}
if (document.myform.class2.value =='0') {
	alert(user_msg['js14']);
	document.myform.class2.focus();
	return false;
}
}</script>
<script>
var num=<?=$num4;?>;
function tianjia(){
	num=num+1;
	num1=num+1;
	var htmc='<table  width="450"  style="width:450px"    cellspacing="0" border="0"><tr ><td  width="149"><input name="suk'+num+'" border="0px" style="padding:4px" type="text" size="20"  value="" /></td><td  width="64"><input name="cb'+num+'" border="0px" style="padding:4px" type="text" size="8" value="" /></td><td  width="64"><input name="jg'+num+'" border="0px" style="padding:4px" type="text" size="8" value="" /></td><td  width="64"><input name="fc'+num+'" border="0px" style="padding:4px" type="text" size="8" value="" /></td><td  width="47"></td><td ></td></tr></table></div><div id="suk'+num1+'">';
	document.getElementById("suk"+num).innerHTML=htmc;
	document.getElementById("num").value=num;
		//	var section=document.getElementById("section").value;
			//var job=document.getElementById("job").value;
	//		var tel=document.getElementById("tel").value;
		//	var ji=document.getElementById("ji").value;
	//		document.getElementById("yibu").src="yibu.php?oper=add&name="+name+"&section="+section+"&job="+job+"&tel="+tel+"&ji="+ji;
	}
</script>
</head>
<body>
<form  method="POST" name="myform" action="../control.php?oper=product_add<?=$u_id;?>" target="_self">
	
<table cellpadding="2" cellspacing="1" class="table">
          <tr> 
            <td colspan="3" class="title">添加内容</td>
          </tr>		  
 <tr> 
            <td class="text"><font class="must">*</font>排序</td>
            <td colspan="2" class="input"> <input name="order" type="text" class="text nonull" value="<?=gv($info,"order1");?>"></td>
          </tr>
		  <tr> 
            <td class="text"><font class="must">*</font>商品名</td>
            <td colspan="2" class="input"> <input name="name" type="text" class="text nonull" value="<?=gv($info,"name");?>"></td>
          </tr>

          <tr> 
            <td class="text"><font class="must">*</font>商户</td>
            <td colspan="2" class="input"> <input name="sh" type="text" class="text nonull" value="<?=gv($info,"sh");?>"></td>
          </tr>
          <tr> 
            <td class="text"><font class="must">*</font>QQ</td>
            <td colspan="2" class="input"> <input name="qq" type="text" class="text nonull" value="<?=gv($info,"qq");?>"></td>
          </tr>
           <tr> 
            <td class="text"><font class="must">*</font>微信</td>
            <td colspan="2" class="input"> <input name="wx" type="text" class="text nonull" value="<?=gv($info,"wx");?>"></td>
          </tr>
          	<tr> 
            <td class="text"><font color='red' >商品图片</span></td>
            <td colspan="2" class="input upload"> 
				<input name="imgurl" id="imgurl"  onkeydown="return false;" type="text" class="text" value="<?=gv($info,"sptu");?>"> 
				<div id='up_img'><iframe ID="UploadFiles" src="../include/upload_photo.php" frameborder=0 scrolling=no></iframe></div>
				
           
				</td>
          </tr> 
           <tr> 
            <td class="text"><font class="must">*</font>推广说明</td>
            <td colspan="2" class="input"> <textarea name="tgsm" cols="50" rows="6" class="ckeditor" style=" padding:5px; color:#666"><?=gv($info,"tgsm");?></textarea></td>
          </tr>
           <tr> 
            <td class="text"><font class="must">*</font>商品SUK</td>
            <td colspan="2" class="input">
            <table  width="450" style="width:450px"  cellspacing="0" border="0">
  <tr align="center">
    <td border="1" width="149">描述</td>
    <td width="64">成本</td>
    <td width="64">价格</td>
    <td width="64">分成</td>

    <td ></td>
  </tr>
  <tr >
    <td  width="149"><input name="suk1" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[1])){echo $suk[1];}?>" /></td>
    <td width="64"><input name="cb1" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[1])){echo $cb[1];}?>" /></td>
    <td width="64"><input name="jg1" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[1])){echo $jg[1];}?>" /></td>
    <td width="64"><input name="fc1" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[1])){echo $fc[1];}?>" /></td>
  </tr>
   <tr >
    <td  width="149"><input name="suk2" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[2])){echo $suk[2];}?>" /></td>
    <td width="64"><input name="cb2" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[2])){echo $cb[2];}?>" /></td>
    <td width="64"><input name="jg2" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[2])){echo $jg[2];}?>" /></td>
    <td width="64"><input name="fc2" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[2])){echo $fc[2];}?>" /></td>
  </tr>
   <tr >
    <td  width="149"><input name="suk3" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[3])){echo $suk[3];}?>" /></td>
    <td width="64"><input name="cb3" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[3])){echo $cb[3];}?>" /></td>
    <td width="64"><input name="jg3" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[3])){echo $jg[3];}?>" /></td>
    <td width="64"><input name="fc3" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[3])){echo $fc[3];}?>" /></td>
  </tr>
   <tr >
    <td  width="149"><input name="suk4" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[4])){echo $suk[4];}?>" /></td>
    <td width="64"><input name="cb4" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[4])){echo $cb[4];}?>" /></td>
    <td width="64"><input name="jg4" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[4])){echo $jg[4];}?>" /></td>
    <td width="64"><input name="fc4" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[4])){echo $fc[4];}?>" /></td>
  </tr>
   <tr >
    <td  width="149"><input name="suk5" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[5])){echo $suk[5];}?>" /></td>
    <td width="64"><input name="cb5" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[5])){echo $cb[5];}?>" /></td>
    <td width="64"><input name="jg5" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[5])){echo $jg[5];}?>" /></td>
    <td width="64"><input name="fc5" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[5])){echo $fc[5];}?>" /></td>
  </tr>
    <tr >
    <td  width="149"><input name="suk6" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[6])){echo $suk[6];}?>" /></td>
    <td width="64"><input name="cb6" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[6])){echo $cb[6];}?>" /></td>
    <td width="64"><input name="jg6" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[6])){echo $jg[6];}?>" /></td>
    <td width="64"><input name="fc6" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[6])){echo $fc[6];}?>" /></td>
  </tr>
    <tr >
    <td  width="149"><input name="suk7" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[7])){echo $suk[7];}?>" /></td>
    <td width="64"><input name="cb7" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[7])){echo $cb[7];}?>" /></td>
    <td width="64"><input name="jg7" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[7])){echo $jg[7];}?>" /></td>
    <td width="64"><input name="fc7" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[7])){echo $fc[7];}?>" /></td>
  </tr>
    <tr >
    <td  width="149"><input name="suk8" border="0px" style="padding:4px" type="text" size="20"  value="<? if(isset($suk[8])){echo $suk[8];}?>" /></td>
    <td width="64"><input name="cb8" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($cb[8])){echo $cb[8];}?>" /></td>
    <td width="64"><input name="jg8" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($jg[8])){echo $jg[8];}?>" /></td>
    <td width="64"><input name="fc8" border="0px" style="padding:4px" type="text" size="8" onkeyup="(this.v=function(){this.value=this.value.replace(/[^0-9-]+/,'');}).call(this)" onblur="this.v();"  value="<? if(isset($fc[8])){echo $fc[8];}?>" /></td>
  </tr>
</table>
  		

</div></td>
          </tr>
          
           <tr> 
            <td class="text"><font class="must">*</font>文案标题</td>
            <td colspan="2" class="input"> <input name="title" type="text" class="text nonull"  value="<?=gv($info,"title");?>"></td>
          </tr>
 			<tr> 
            <td class="text">文案链接</td>
            <td colspan="2" class="input"><input name="url" type="text" class="text" value="<?=gv($info,"url");?>"></td>
          </tr>
		<tr> 
            <td class="text">文案说明</td>
            <td colspan="2" class="input"><textarea style=" padding:5px; color:#666" name="wasm" cols="50" rows="6" class="text"><?=gv($info,"wasm");?>
            </textarea>
            用于搜索引擎优化,多个关键词请用","隔开</td>
          </tr>
		<tr> 
            <td class="text">跳转链接</td>
            <td colspan="2" class="input"><input name="prurl" type="text" class="text" value="<?=gv($info,"prurl");?>"></td>
          </tr>

		  <tr> 
            <td class="text"></td>
	      <td class="submit"><input type="submit" name="Submit" value="保存" class="submit" onclick="return Smit($(this),'myform')" /><input type="reset" name="Submit" value="重置" class="reset" /> </td>
          </tr>
		<tr>
		  <td class="footer" colspan="2"> </td>
	  </tr>
</table>        
</form>
</body>
</html>
